﻿using System;
using AsNum.Common.EntLib.Validation;
using AsNum.MySecret.Entity.Bussiness;

namespace TestWeb {
    public partial class Default : System.Web.UI.Page {

        protected string Rules {
            get;
            set;
        }

        protected void Page_Load(object sender , EventArgs e) {
            var builder = new MapBuilder<StudentEntity> ( );
            builder.Map ( l => l.Name , txtName, "Name" )
                .Map ( l => l.Birthday , txtBirthday, "Birthday" )
                .Map ( l => l.Email , txtEmail, "Email" )
                .Map ( l => l.ReEmail , txtReEmail )
                .Map ( l => l.Sex , rblSex )
                .Map ( l => l.Scores.Project , txtProject1 )
                .Map ( l => l.Scores.Score , txtScore1 )
                .Map ( l => l.Scores.Project , txtProject2 )
                .Map ( l => l.Scores.Score , txtScore2 );

            this.Rules = ValidationHelper.GetClientRules ( typeof ( StudentEntity ) , "AddStudent" , builder.Maps );
        }
    }
}